Skip to content

Conversation

d3varaja
Copy link

Initial implementation of @asgardeo/tanstack-router, providing a for TanStack Router. This enables auth-guarded routes with Asgardeo, removing the need for manual useAsgardeo wiring and aligning with the DX of @asgardeo/react-router.

Purpose

  • Deliver first-class TanStack Router support (requested in feat: implement @asgardeo/tanstack-router package for route protection #152).
  • Guard routes declaratively with using isSignedIn/isLoading.
  • Support fallback, redirectTo, and loader props.
  • Fail-fast with AsgardeoRuntimeError if neither fallback nor redirectTo provided.
  • API mirrors @asgardeo/react-router for easy migration.

Related Issues

Checklist

  • e2e cypress tests locally verified
  • Manual test round performed and verified
  • UX/UI review done on the final implementation
  • Documentation provided (README + migration guide)
  • Unit tests provided (export/shape checks)
  • Integration tests provided

Security checks

@pavinduLakshan pavinduLakshan changed the title feat(tanstack-router): implement @asgardeo/tanstack-router with <ProtectedRoute /> for auth-guarded routes (closes #152) feat(tanstack-router): implement @asgardeo/tanstack-router with <ProtectedRoute /> for auth-guarded routes Sep 28, 2025
@brionmario
Copy link
Member

Hey @d3varaja,

Thanks alot for the PR.
I've approved workflow runs.

There seems to be some failures due to pnpm-lock being not commited.
Please commit that as well.

Additionally, shall we do the following tasks as well:

  1. Have a simple sample under the samples directory.
samples:
    - react-tanstack-router

The samples should be:

  • Scaffolded with vite (React TS Template)
  • Have a protected page (ex: Dashboard.tsx) -> Protected with the ProtectedRoute from @asgardeo/tanstack-router
  • Have a root component that's unprotected (ex: Home.tsx)
  1. Send a PR to the official docs space (https://wso2.com/asgardeo/docs/sdks/react/guides/protecting-routes/)

Note

We may have to restructure the current structure to include both router options. i.e @asgardeo/react-router & @asgardeo/tanstack-router

@d3varaja
Copy link
Author

d3varaja commented Oct 1, 2025

hi @brionmario,

i created a pr for the documentation update at wso2/docs-is#5607 please feel free to check it out

thanks!

@brionmario brionmario changed the title feat(tanstack-router): implement @asgardeo/tanstack-router with <ProtectedRoute /> for auth-guarded routes feat(tanstack-router): implement @asgardeo/tanstack-router with <ProtectedRoute /> for auth-guarded routes Oct 1, 2025
@brionmario
Copy link
Member

brionmario commented Oct 1, 2025

hi @brionmario,

i created a pr for the documentation update at wso2/docs-is#5607 please feel free to check it out

thanks!

Cool. Will check 🙌

Shall we work on the sample as well?

@d3varaja
Copy link
Author

d3varaja commented Oct 1, 2025

hi @brionmario,
i created a pr for the documentation update at wso2/docs-is#5607 please feel free to check it out
thanks!

Cool. Will check 🙌

Shall we work on the sample as well?

working on it right now, will push in a bit

d3varaja and others added 4 commits October 1, 2025 14:48
Initial implementation of @asgardeo/tanstack-router, providing a ProtectedRoute component for route protection with authentication checks in TanStack Router-based React applications. Includes configuration, documentation, tests, build setup, and TypeScript support.
Introduces a comprehensive test suite for the ProtectedRoute component, covering scenarios for authentication, loading state, fallback and redirect behavior, and error handling. This improves test coverage and ensures correct behavior under various conditions.
Introduced a new sample application under samples/react-tanstack-router demonstrating integration of Asgardeo authentication with TanStack Router in a React app. Updated the TanStack Router package README to reference the new sample. Added related configuration, source files, and dependencies.
@d3varaja d3varaja force-pushed the feature/tanstack-protected-route branch from 014df30 to 3aa740d Compare October 1, 2025 09:20
@d3varaja
Copy link
Author

d3varaja commented Oct 1, 2025

@brionmario pushed the sample application, feel free to look at it when you have some time, thanks

@brionmario
Copy link
Member

brionmario commented Oct 3, 2025

@brionmario pushed the sample application, feel free to look at it when you have some time, thanks

Great!
Let me have a look and get back.

Meantime, lets do the following:

@asgardeo-github-bot
Copy link

⚠️ No Changeset found

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go.

If these changes should result in a version bump, you need to add a changeset.

Refer Release Documentation to learn how to add a changeset.

Add lockfile entries for newly added i18n package dependencies including build tools, linting, and testing packages
@d3varaja
Copy link
Author

d3varaja commented Oct 3, 2025

hi @brionmario, i updated the lock file which was causing the ci/cd issues and also add the change set, let me know if there is any issues with them, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: implement @asgardeo/tanstack-router package for route protection
3 participants